package com.lsx.logisticscore.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

@Data
@TableName("ticket_log")
public class Log implements Serializable {
    @TableId(type = IdType.AUTO)
    private Integer logId;

    private Integer ticketId;

    private String managerId;

    @TableField("manager_name")
    private String managerName;

    private String status;

    private String position;

    private Date time;

    private static final long serialVersionUID = 1L;

    public Log(){}
    public Log(Integer ticketId, String managerId, String managerName, String status, String position) {
        this.ticketId = ticketId;
        this.managerId = managerId;
        this.managerName = managerName;
        this.status = status;
        this.position = position;
        this.time = new Date();
    }

    public String getTime(){
        if(this.time != null){
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            return sdf.format(this.time);
        }
        return null;
    }
}